//https://gitee.com/that_period/201705050159_nachi/tree/master
package pkg201705050159;
interface ShapeArea{
    double getArea(); 
    double getPerimeter();
}

class Rectangle implements ShapeArea{
    double width;
    double height;
    double area;
    double permeter;
    Rectangle(double w, double h){
        width=w;
        height=h;
    }
    @Override
    public double getArea() {
        area=width*height;
        return area;
    }
    @Override
    public double getPerimeter() {
        permeter=2*(width+height);
        return permeter;
    }
    @Override
    public String toString(){
return "长方形高为：="+height+"  长方形宽为：="+width+"  长方形面积为：="+area+"  长方形周长为：="+permeter;
}
}

class Circle implements ShapeArea{
    double banjing;
    final double pai=3.1415926;
    double area;
    double permeter;
    Circle(double w){
        banjing=w;
    }
    @Override
    public double getArea() {
        area=banjing*banjing*pai;
        return area;
    }
    @Override
    public double getPerimeter() {
        permeter=2*banjing*pai;
        return permeter;
    }
    @Override
    public String toString(){
return "圆形半径为：="+banjing+"   圆周率为：="+pai+"   圆形面积为：="+area+"   圆形周长为：="+permeter;
}
}
public class Text {
    public static void main(String [] args){
        ShapeArea rectangle=new Rectangle(5,9);
        rectangle.getArea();
        rectangle.getPerimeter();
        System.out.println(rectangle.toString());
        ShapeArea circle=new Circle(3);
        circle.getArea();
        circle.getPerimeter();
        System.out.println(circle.toString());
    }
}